The present invention relates to event notification in a software system, and more particularly to the managing of subscriptions in event notification in a software system.
Software systems which use subscription based message delivery systems are well known in the art. A typical event model utilizes event subscribers and event sources. JAVA 1.1 is one example software system which uses this event model. Event sources are software components which send notifications of its events to software components on its subscriber list. Event subscribers are software components which are to be notified of events on another software component. An event subscriber sends a request to an event source to be placed on its subscriber list. The event source then forwards notifications for all events that it generates to the event subscribers on its subscriber list.
This model requires event subscribers to subscribe to receive all notifications from an event source or none at all. However, event subscribers typically are not interested in all of the events of an event source. For example, in a digital camera, an event subscriber may be a software component which controls the hardware for capturing an image. An event source may be a software component that controls the buttons on the digital camera. Because of its function, the software component is only interested in shutter button events and not all button events. However, in a conventional digital camera, the software component is required to subscribe to all button events. It then must expend time and memory to examine all button event notifications and process only those pertaining to the shutter button.
On some systems, the notifications are partitioned into categories or subsets of notifications. However, to support such partitioning, either the event subscribers have a more complex subscription process and/or the event sources have a more complex task in managing the various subscription levels. In either instance, supporting partitioned notifications consumes more processor time and memory resources. In addition, with partitions, for event subscribers to be notified of all events of an event source, or to be notified of events in more than one category, the event subscriber would need to separately subscribe to each event category of interest. This further complicates the task of event sources in managing their subscriber lists.
Accordingly, there exists a need for an improved method and system for managing subscriptions in a software system. The present invention addresses such a need.
The present invention provides a method and system for managing subscriptions in a software system. The method includes sending a request to a child notification publisher to send a notification message to at least one subscriber on the child notification publisher""s subscriber list; sending the notification message to the subscribers on the child notification publisher""s subscriber list; and sending a request to a parent notification publisher to send the notification message to the at least one subscriber on the parent notification publisher""s subscriber list. The method and system in accordance with the present invention utilizes a publisher tree for managing subscriptions. This tree allows event subscribers to request subscriptions at a granular level without requiring the event subscribers who do not need a granular subscription to have multiple subscriptions to receive whole categories of messages from event sources. Further, this tree does not require the event sources to know anything about the event subscribers or what messages they are interested in receiving. Event sources only need to know the most granular level of subscriptions that the system supports, i.e., the leaf nodes of the tree. The structure of the publisher tree may thus be dynamically altered without the need to rewrite the programs at the event sources and subscribers. If the leaf nodes change, then the event sources will require minimal modifications, and the event subscribers will require updating. These changes may be implemented at run-time. The present invention also requires less event processing time and memory than conventional methods.